import request from '@/utils/request'

// 售货机
export const getVmSearch = data => request.get('/vm-service/vm/search', { params: data })

// 售货机类型列表
export const getDeviceInfo = data => request.get('/vm-service/vmType/search', { params: data })

// 点位搜索
export const getNodeInfo = data => request.get('/vm-service/node/search', { params: data })

// 新增售货机
export const addNode = data => request.post('/vm-service/vm', data)

// 售货机类型详情
export const getVmType = typeId => request.get(`/vm-service/vmType/${typeId}`)

// 获取售货机货道详情
export const getChannelList = innerCode => request.get(`/vm-service/channel/channelList/${innerCode}`)

// 策略管理
export const getPolicy = () => request.get('/vm-service/policy')

// 实施策略
export const putPolicy = data => request.put('/vm-service/vm/applyPolicy', data)

// 查询售货机策略
export const getPlicyCode = innerCode => request.get(`/vm-service/policy/vmPolicy/${innerCode}`)

// 取消策略
export const closePkicy = data => request.put(`/vm-service/vm/cancelPolicy/${data.innerCode}/${data.policyId}`)

// 修改售货机点位
export const putNodeInfo = data => request.put(`/vm-service/vm/${data.id}/${data.nodeId}`)

// 商品搜索
export const GetSku = params => request.get('/vm-service/sku/search', { params })

// 货道配置
export const channelConfig = data => request.put('/vm-service/channel/channelConfig', data)

// 商圈列表
export const businessType = id => request.get(`/vm-service/businessType/name/${id}`)

// 获取商圈下销量前10的商品(补货推荐)
export const businessTop = businessId => request.get(`/vm-service/sku/businessTop10/${businessId}`)
